// console.log(x) // => ReferenceError: x is not defined

{
    try {
        const x = 2;
        x = 3  // => TypeError: Assignment to constant variable.
    } catch (e) {
        console.log(e instanceof TypeError); // true
        console.log(e.message); //
        console.log(e.name); // TypeError
    }
}

try {
    let a = undefinedVariable;
} catch (e) {
    console.log(e instanceof ReferenceError); // true
    console.log(e.message); // "undefinedVariable is not defined"
    console.log(e.name); // "ReferenceError"
    // console.log(e.stack); // Stack of the error
}

{
    console.log('Line 1')

    try {
        console.log('Line 2')
        throw new Error();
        console.log('Line 3')
    } catch (err) {
        console.log('Line in catch!')
    } finally {
        console.log('Line in finally!')
    }
}
